<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - logger_config_file.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2007  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#ifndef</font> DLIB_LOGGER_CONFIg_FILE_
<font color='#0000FF'>#define</font> DLIB_LOGGER_CONFIg_FILE_ 

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='logger_kernel_abstract.h.html'>logger_kernel_abstract.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='logger_kernel_1.h.html'>logger_kernel_1.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>string<font color='#5555FF'>&gt;</font>
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../config_reader.h.html'>../config_reader.h</a>"

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>namespace</font> dlib
<b>{</b>
    <font color='#0000FF'>class</font> <b><a name='logger_config_file_error'></a>logger_config_file_error</b> : <font color='#0000FF'>public</font> error 
    <b>{</b>
        <font color='#009900'>/*!
            WHAT THIS OBJECT REPRESENTS
                This is the exception class used by the configure_loggers_from_file()
                function defined below.
        !*/</font>
    <font color='#0000FF'>public</font>: 
        <b><a name='logger_config_file_error'></a>logger_config_file_error</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> s<font face='Lucida Console'>)</font>:error<font face='Lucida Console'>(</font>s<font face='Lucida Console'>)</font><b>{</b><b>}</b>
    <b>}</b>;

    <font color='#0000FF'><u>void</u></font> <b><a name='configure_loggers_from_file'></a>configure_loggers_from_file</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> file_name
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        ensures
            - configures the loggers with the contents of the file_name file
        throws
            - dlib::logger_config_file_error
                this exception is thrown if there is a problem reading the config file
    !*/</font>

    <font color='#0000FF'><u>void</u></font> <b><a name='configure_loggers_from_file'></a>configure_loggers_from_file</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> config_reader<font color='#5555FF'>&amp;</font> cr 
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        ensures
            - configures the loggers with the contents of cr.  This function is just like
              the above version that reads from a file except that it reads from an in-memory
              config_reader instead.
        throws
            - dlib::logger_config_file_error
                this exception is thrown if there is a problem reading the config file
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#009900'>/*!  
        #  -----------------------------------------------
        #  ------------- EXAMPLE CONFIG FILE -------------
        #  -----------------------------------------------

        # The overall format of the config file is the same as the one defined by
        # the config_reader component of this library.  
        
        # This line is a comment line

        # The config file always has a block named logger_config.  This is where all the 
        # config data for the loggers reside.
        logger_config
        {
            # This sets all loggers to the level LINFO since it is just inside the 
            # logger_config block
            logging_level = info

            # Alternatively we could specify a user defined logging level by
            # supplying a priority number.  The following line would specify 
            # that only logging levels at or above 100 are printed.  (note that 
            # you would have to comment out the logging_level statement above 
            # to avoid a conflict).
            # logging_level = 100 

            parent_logger 
            {
                # This sets all loggers named "parent_logger" or children of
                # loggers with that name to not log at all (i.e. to logging level
                # LNONE).
                logging_level = none
            }


            parent_logger2
            {
                # set loggers named "parent_logger2" and its children loggers
                # to write their output to a file named out.txt
                output = file out.txt 

                child_logger
                {
                    # Set loggers named "parent_logger2.child_logger" and children of loggers
                    # with this name to logging level LALL
                    logging_level = all

                    # Note that this logger will also log to out.txt because that is what
                    # its parent does and we haven't overridden it here with something else.
                    # if we wanted this logger to write to cout instead we could uncomment
                    # the following line:
                    # output = cout
                }
            }
        }

        # So in summary, all logger config stuff goes inside a block named logger_config.  Then
        # inside that block all blocks must be the names of loggers.  There are only two keys,
        # logging_level and output.
        #
        # The valid values of logging_level are:
        #   "LALL", "LNONE", "LTRACE", "LDEBUG", "LINFO", "LWARN", "LERROR", "LFATAL",  
        #   "ALL",   "NONE",  "TRACE",  "DEBUG",  "INFO",  "WARN",  "ERROR",  "FATAL", 
        #   "all",   "none",  "trace",  "debug",  "info",  "warn",  "error",  "fatal", or  
        #   any integral value
        # 
        # The valid values of output are:
        #   "cout", "cerr", "clog", or a string of the form "file some_file_name"
        #   which causes the output to be logged to the specified file.
        #
    !*/</font>


<b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>#ifdef</font> NO_MAKEFILE
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='logger_config_file.cpp.html'>logger_config_file.cpp</a>"
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_LOGGER_CONFIg_FILE_
</font>



</pre></body></html>